package com.xh.bussiness.scheduletask;

import com.xh.bussiness.thirdapi.xinzhou.bean.request.XzStudentInfoRequest;
import com.xh.bussiness.thirdapi.xinzhou.config.XzConfig;
import com.xh.bussiness.thirdapi.xinzhou.service.IXinzhouTmsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Service;


@Service
public class XinZhouScheduleTaskService {

    @Autowired
    private XzConfig config;
    @Autowired
    private IXinzhouTmsService xinzhouTmsService;


    @Scheduled(cron = "0 30 2 * * ?")
    public void asyncStudents(){
        if(!config.isAsyncStudentEnabled()){
            return;
        }
        try {
            XzStudentInfoRequest request = new XzStudentInfoRequest();
            request.setSearchType(1);
            xinzhouTmsService.queryStudents(request);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}
